#!/bin/sh
# 执行git拉取源码
echo '开始拉取=========================================='
cd /home/project/xsgl-web
gitLog=`git pull`
if [ $? -ne 0  ];
then
    echo $gitLog
    exit $?
fi
echo "$gitLog" | while read line
do
    echo $line
done
echo '完成拉取代码======================================'
echo '执行npm打包====================================='
cd /home/project/xsgl-web
npm install
npm run build:prod
cp -r /home/project/xsgl-web/dist/. /usr/share/nginx/html
echo '完成npm打包======================================'
nginx -s reload
echo '启动完毕============================================'
